package com.rgs.springboot.autoconfig;

import com.rgs.springboot.annotate.RgsConditionalOnClass;
import com.rgs.springboot.webServer.JettyWebServer;
import com.rgs.springboot.webServer.TomcatWebServer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author RenGaoshuai
 * @date 2024/7/2 11:08
 * @description 自定义的webServer配置类
 */
@Configuration
public class WebServiceAutoConfiguration implements RgsAutoConfiguration{


    @Bean
    @RgsConditionalOnClass(className = "org.apache.catalina.startup.Tomcat")//自定义注解，标识：如果存在这个类，那么就生成这个bean
    public TomcatWebServer tomcatWebServer() {
        return new TomcatWebServer();
    }

    @Bean
    @RgsConditionalOnClass(className = "org.eclipse.jetty.server.Server")//自定义注解，标识：如果存在这个类，那么就生成这个bean
    public JettyWebServer jettyWebServer() {
        return new JettyWebServer();
    }
}
